<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>样式操作</title>
    <style>
        .box{
            width: 300px;
            height: 300px;
            background: pink;
            position: relative;
            left: 300px;
        }
        .span{
            width: 50px;
            height: 50px;
            background: red;
            position: absolute;
            left: 100px;
            border: 5px solid #58bc58;
            padding: 20px;
        }
    </style>
</head>
<body>
    <div class="box">
        <div class="span"></div>
    </div>

    <script src="./js/jquery.3.5.1.js"></script>
    <script>
        $(function(){
            // 1. 宽
            // 1.1 content
            console.log($('.span').width());
            // 1.2 content + padding
            console.log($('.span').innerWidth());
            // 1.3 content + padding + border
            console.log($('.span').outerWidth());

            // 2. 高
            // 2.1 content
            console.log($('.span').height());
            // 2.2 content + padding
            console.log($('.span').innerHeight());
            // 2.3 content + padding + border
            console.log($('.span').outerHeight());

            // 3. 位置
            // 3.1 获取
            console.log($('.span').position());
            console.log($('.span').offset());
            // 3.2 设置
            $('.span').offset({left:200})

        })
    </script>
</body>
</html>